package TUILayer;
import java.util.Scanner;
import ControlLayer.*;
/**
 * brugernes indgang til systemmet,
 * her laves main menu med construktours, til at starte systemmet op
 * 
 * @author (gruppe4) 
 * @version (a version number or a date)
 */
public class MainMenuUI
{
    // instance variables - replace the example below with your own
    private PrivateCustomerUI priUI ;//reference til PrivateCustomer.
    private OrderUI odrUI;// reference til Order
    private ItemUI itemUI;// reference til item
    // private PrintUI prinUI;// reference til print
    /**
     * Constructor for objects of class MainMenu
     */
    public MainMenuUI()
    {
        priUI = new PrivateCustomerUI();
        odrUI = new OrderUI();
        itemUI = new ItemUI();
    }

    public void mainMenuUIStart()
    {
        boolean exit=false;
        while(!exit)
        {
            int choice = writeMainMenu();
            if(choice == 1)
            {
                startPrivateCustomer();
            }
            else 
            {
                if(choice == 2)
                {
                    startOrder();
                }
                else 
                {
                    if(choice == 3){
                        startItem();
                    }
                    else 
                    {
                        if(choice == 4)
                        {
                            //  startPrint();
                        }
                        else 
                        {
                            if(choice == 5)
                            {
                                writeEnd();
                                exit=true;
                            }
                        }
                    }
                }
            }
        }
    }

    private int writeMainMenu()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("***Hoved Menu***");
        System.out.println("** Privatkunde Menu(1) **");
        System.out.println("** Ordre Menu(2) **");
        System.out.println("** Vare Menu(3) **");
        System.out.println("** Print Menu(4) **");
        System.out.println("** Menu(5) luk **");
        System.out.println("\n Foretag et valg ");
        int choice = keyboard.nextInt();
        return choice;
    }

    private void startPrivateCustomer()
    {
        priUI = new PrivateCustomerUI();
        priUI.start();
    }

    private void startOrder()
    {
        odrUI = new OrderUI();
        odrUI.start();
    }

    private void startItem()
    {
        itemUI = new ItemUI();
        itemUI.start();
    }

    private void writeEnd()
    {
        System.out.println(" Systemmet lukker ned ");
    }
}